<!DOCTYPE html>
<html lang="en">
<head>
	<meta content="width=device-width,initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
	<meta name="apple-mobile-web-app-capable" content="no" />
	<meta charset="UTF-8">
	<title>{{.s_title}}</title>
	<style type="text/css"></style>
	<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/mui/js/mui.min.js"></script>
	<link href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/mui/css/mui.min.css" rel="stylesheet" />
	<!-- <link rel="stylesheet" type="text/css" href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/css/all.css"> -->
	<link rel="stylesheet" type="text/css" href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/css/app.css">
	<link rel="stylesheet" type="text/css" href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/sui/Css/SUI.css">
	<link rel="stylesheet" type="text/css" href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/sui/Font/iconfont.css">
</head>
<body class="sign">
	<form>
	<input type="number" pattern="[0-9]*" name="mobile" placeholder="手机号码">
	<input type="password" name="password" placeholder="设置登录密码">
	<span class="yzm"><input type="number" name="code" placeholder="短信验证码"><span class="get">获取验证码</span></span>
	</form>
	<button id="sign">确认注册</button>
	<span class="butt fl" onclick="back()">取消</span>
	<!-- <div class="other suiOp7">
		<dl>
			<dt><span>其他登录</span></dt>
			<dd>
				<img src="../img/icon-wechat-a.png" alt="" onclick="wxlogin()">
				<span>微信</span>
			</dd>
			<dd>
				<img src="../img/icon-qq-a.png" alt="" onclick="qqlogin()">
				<span>QQ</span>
			</dd>
			<dd>
				<img src="../img/alipay.png" alt="" onclick="alilogin()">
				<span>支付宝</span>
			</dd>
		</dl>
	</div> -->
</body>

<script type="text/javascript" src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/sui/Js/SUI.js"></script>
<script type="text/javascript" src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/js/zepto.min.js"></script>
{{template "wechat/public/share.html" .}}	
<script type="text/javascript" language="javascript">
	var yzm = 0;
	function back(){
		history.back()
	}
	var value = "";
	var date;
	$('span.get').click(function(event) {
		var mobile=$("input[name=mobile]").val()
		if ( mobile== "") {
			mui.toast("请输入手机号码~")
		}else if (mobile.length != 11) {
			mui.toast("请输入正确的号码~")
		} else {
			if (yzm == 0) {
				var that=this
				that.disabled=true
				$.ajax({
					url:'/mobile/login/smssend',
					data:{mobile:mobile,type:1,app:"fbe661719decefe5e632cf7cbd8fb737"},
					success:function(res){
						if(res==1){
							// mui.toast("验证码获取成功~")
							$('.get').text('60秒后重新获取')		
							timeout()
							yzm = 1
						}else if(res==0){
							mui.toast("服务繁忙,请稍后再试~")
						}else if(res==2){
							mui.toast("该号码已注册~")
						}else{
							mui.toast("服务繁忙,请稍后再试~")
						}
						that.disabled=false
					},error:function(){
						mui.toast("服务繁忙,请稍后再试~")
						that.disabled=false
					}
				})
			}else {
				mui.toast("请稍后再在获取~")
			}
		}
	});
	$('#sign').click(function(){
		var mobile=$("input[name=mobile]").val()
		if(mobile.length!=11){
			mui.toast("请输入正确的号码~");
			return false;
		}
		if($("input[name=code]").val().length!=6){
			mui.toast("请输入验证码~");
			return false;
		}
		if($("input[name=password]").val()==""){
			mui.toast("请输入密码~");
			return false;
		}
		var that=this
		that.disabled=true
		var form=$('form').serialize()
		$.ajax({
			url:window.location.href,
			data:form,
			type:'post',
			success:function(res){
				if(res==1){
					mui.alert('注册成功',function(){
					window.location.href="/mobile/my"
					})
				}else if(res==2){
					mui.toast("号码已注册!");
				}else if(res==3){
					mui.toast("验证码错误!");
				}else if(res==0){
					mui.toast("网络繁忙,请稍后再试!");
				}else if(res==4){
					mui.toast("密码错误!");
				}
				that.disabled=false
			},error:function(){
				mui.toast("网络繁忙,请稍后再试!");
				that.disabled=false
			}
		})
	})
	function timeout(){
		var time = 60;
		var tt = setInterval(function(){
			if (time == '0') {
				$('.get').text('重新获取验证码')
				clearInterval(tt)
				yzm = 0
			}else {
				time--
				$('.get').text(time+'秒后重新获取')
			}
		},1000)
	}
</script>
</html>